package com.lh.tams.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lh.tams.domain.TamsParty;
import com.lh.tams.service.PartyService;
import com.lh.tams.util.DataGridModel;
import com.lh.tams.util.ID;
import com.lh.tams.util.Page;
import com.lh.tams.util.diy.Json;

@RequestMapping("/party")
@Controller
public class PartyController {
	
	private PartyService partyService;

	public void setPartyService(PartyService partyService) {
		this.partyService = partyService;
	}
	
	@RequestMapping("/query.adm")
	@ResponseBody
	public Page query(DataGridModel dgm,String caseNo){
		return partyService.query(dgm, caseNo);
	}
	
	@RequestMapping("/queryParty.adm")
	@ResponseBody
	public String query(String caseNo){
		return partyService.query(caseNo);
	}
	
	@RequestMapping("/add.adm")
	@ResponseBody
	public Json add(TamsParty party){
		party.setIdBgt(ID.next());
		partyService.add(party);
		Json json = new Json();
		return json;
	}
	
	@RequestMapping("/update.adm")
	@ResponseBody
	public Json update(TamsParty party){
		partyService.update(party);
		Json json = new Json();
		return json;
	}
	
	@RequestMapping("/del.adm")
	@ResponseBody
	public Json delete(long[] id){
		partyService.delete(id);
		return new Json();
	}
	
}
